package com.juyou.rider.app.api.order;


import com.laituo.juyou.core.annotation.HttpMethod;
import com.laituo.juyou.core.annotation.HttpOpenApi;
import com.laituo.juyou.core.annotation.HttpParam;
import com.laituo.juyou.core.annotation.HttpParamType;
import com.laituo.juyou.core.annotation.param.NotNull;
import com.laituo.juyou.core.exception.AdminServiceException;
import com.laituo.juyou.core.exception.ServiceException;
import com.laituo.juyou.data.domain.RiderOrderDO;
import com.laituo.juyou.data.dto.order.OrderRiderDTO;
import com.laituo.juyou.data.dto.rider.RiderLoginDTO;
import com.laituo.juyou.data.model.Page;

import java.rmi.ServerException;
import java.util.Date;

/**
 * @description: 骑手订单接口
 * @author: xuyang
 * @date: 2020/03/03 21:02
 **/
@HttpOpenApi(group = "app.riderOrder", description = "骑手订单")
public interface RiderOderService {
    /**
     * 获取骑手订单接口
     *
     * @param pageNo    页码
     * @param pageSize  页码长度
     * @param storageId 仓库id
     * @return Page<OrderRiderDTO>
     * @throws ServerException 异常
     */
    @HttpMethod(description = "获取订单列表")
    public Page<OrderRiderDTO> getRiderOrderPage(
            @HttpParam(name = "page", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer pageNo,
            @HttpParam(name = "pageSize", type = HttpParamType.COMMON, description = "页码长度", valueDef = "10") Integer pageSize,
            @HttpParam(name = "storageId", type = HttpParamType.COMMON, description = "仓库id") String storageId) throws ServerException;

    /**
     * 骑手抢单功能
     *
     * @param riderId   骑手id
     * @param orderId   订单id
     * @param storageId 仓库id
     * @return Boolean
     * @throws ServerException       异常
     * @throws AdminServiceException 异常
     */
    @HttpMethod(description = "骑手抢单")
    public Boolean riderRobOrder(
            @HttpParam(name = "riderId", type = HttpParamType.COMMON, description = "骑手id") String riderId,
            @HttpParam(name = "orderId", type = HttpParamType.COMMON, description = "订单id") String orderId,
            @HttpParam(name = "storageId", type = HttpParamType.COMMON, description = "仓库id") String storageId) throws ServerException, AdminServiceException;


    /**
     * 骑手任务列表
     *
     * @param pageNo   页码
     * @param pageSize 页码长度
     * @param riderId  骑手id
     * @return Page<RiderOrderDO>
     * @throws ServerException 异常
     */
    @HttpMethod(description = "骑手任务列表")
    public Page<RiderOrderDO> getRiderTaskPage(
            @HttpParam(name = "page", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer pageNo,
            @HttpParam(name = "pageSize", type = HttpParamType.COMMON, description = "页码长度", valueDef = "10") Integer pageSize,
            @HttpParam(name = "riderId", type = HttpParamType.COMMON, description = "骑手id") String riderId) throws ServerException;

    /**
     * 查询历史订单信息
     *
     * @param pageNo   页码
     * @param pageSize 页码长度
     * @param riderId  骑手id
     * @return Page<RiderOrderDO>
     * @throws ServerException 异常
     */
    @HttpMethod(description = "历史订单")
    public Page<RiderOrderDO> getHistoryTaskPage(
            @HttpParam(name = "page", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer pageNo,
            @HttpParam(name = "pageSize", type = HttpParamType.COMMON, description = "页码长度", valueDef = "10") Integer pageSize,
            @HttpParam(name = "riderId", type = HttpParamType.COMMON, description = "骑手id") String riderId,
            @HttpParam(name = "startTime", type = HttpParamType.COMMON, description = "开始时间") String startTime,
            @HttpParam(name = "endTime", type = HttpParamType.COMMON, description = "结束时间") String endTime) throws ServerException;

    /**
     * 根据主键ID获取配送员总单数等信息
     *
     * @param riderId   配送员主键ID
     * @param startTime 开始时间
     * @param endTime   结束时间
     * @return RiderLoginDTO
     * @throws ServiceException 异常信息
     */
    @HttpMethod(description = "根据主键ID获取配送员总单数等信息")
    public RiderLoginDTO getRiderHistoryMoney(
            @NotNull @HttpParam(name = "riderId", type = HttpParamType.COMMON, description = "配送员主键ID") Long riderId,
            @HttpParam(name = "startTime", type = HttpParamType.COMMON, description = "开始时间") String startTime,
            @HttpParam(name = "endTime", type = HttpParamType.COMMON, description = "结束时间") String endTime
    ) throws ServiceException;
}
